<template>
  <div>
    <el-dialog title="编辑" v-model="visible" width="360px" >
      <el-form ref="formRef" :model="formData" label-position="right" label-width="100px">
        <el-form-item label="籍贯" prop="nativePlace">
          <el-input v-model="formData.nativePlace"/>
        </el-form-item>
        <el-form-item label="客户主观意愿" prop="trusteeshipMemo">
          <el-input v-model="formData.trusteeshipMemo"/>
        </el-form-item>
        <el-form-item label="身份证号" prop="identityCard">
          <el-input v-model="formData.identityCard"/>
        </el-form-item>
        <el-form-item label="地址" prop="identityAddress">
          <el-input v-model="formData.identityAddress"/>
        </el-form-item>
        <el-form-item label="预留手机号" prop="identityPhone">
          <el-input v-model="formData.identityPhone"/>
        </el-form-item>
        <el-form-item label="转接类型" prop="transferType">
          <el-input v-model="formData.transferType"/>
        </el-form-item>
        <el-form-item label="平台密码" prop="platPassword">
          <el-input v-model="formData.platPassword"/>
        </el-form-item>
      </el-form>
      <template #footer>
          <span class="dialog-footer">
            <el-button @click="visible = false">取 消</el-button>
            <el-button type="primary" @click="updateNativePlaceHandle" >确 定</el-button>
          </span>
      </template>

    </el-dialog>
  </div>
</template>

<script lang="ts" setup>
const visible = ref(false)
const formRef = ref()
const formData = ref({})

const rowDataCopy = ref({})

import request from '@/config/axios'
const emit = defineEmits(["ok"])
const updateNativePlaceHandle = async function () {
  await request.post({
    url: '/order/updateNativePlaceHandle',
    data: {...formData.value, id: rowDataCopy.value.orderId}
  })
  visible.value = false
  emit("ok")
}




defineExpose({
  edit: (rowData) => {
    console.log('---1----',rowData)
    visible.value = true
    formData.value.nativePlace = rowData.nativePlace
    formData.value.trusteeshipMemo = rowData.trusteeshipMemo
    formData.value.identityCard = rowData.identityCard
    formData.value.identityAddress = rowData.identityAddress
    formData.value.identityPhone = rowData.identityPhone
    formData.value.transferType = rowData.transferType
    formData.value.platPassword = rowData.platPassword
    rowDataCopy.value = rowData
  }
})
</script>


<style scoped>

</style>
